<?php
for ($i = 0; $i < $len_category; $i++) {
	$catid = $children[$i]['category_id'];
	$cat = $soap->call ($session_id, 'catalog_category.info', $catid);
	$cat_name = $cat['name'];
	// echo print_r($cat);
	// echo $cat['image'];
	//echo "<div>";
	echo "<a name=\"$catid\">$cat_name</a><br/>";

	// show products under each category
	$products = $soap->call( $session_id, 'catalog_category.assignedProducts', $catid);
	$len_product = sizeof($products);
	for ($j = 0; $j < $len_product; $j++) {
		$p = $soap->call ($session_id, 'catalog_product.info', $products[$j]['product_id']);
		$pid = $p['product_id'];
		$imgs_product = $soap->call ($session_id, 'catalog_product_attribute_media.list', $pid);
		$img_url = $imgs_product[0]['url'];
		$short = $p['short_description'];
		echo "<div class='product'>";
		echo "<div class='product_img'><img src='$img_url' /></div>";
		echo "<div class='product_info'>$short&nbsp;<a href='/etronix/detail.php#$pid?cid=$catid'>Details</a></div>";
		echo "</div>";
		// echo print_r($p);
	}
	//echo "</div>";
}	
?>